﻿

using System.Diagnostics;
namespace MyMenu.action
{
    public class ExecuteCommand : AbstractAction
    {

        public bool hidden
        {
            get;
            set;
        }

        public string command
        {
            get;
            set;
        }

        public string param
        {
            get;
            set;
        }

        public ExecuteCommand(string command, string param, bool hidden)
        {
            this.command = command;
            this.param = param;
            this.hidden = hidden;
        }


        public ExecuteCommand(string command, string param)
        {
            this.command = command;
            this.param = param;
            this.hidden = false;
        }

        public override void execute() 
        {
            ProcessStartInfo startInfo = new ProcessStartInfo();
            if (hidden)
            {
                startInfo.CreateNoWindow = true;
                startInfo.WindowStyle = ProcessWindowStyle.Hidden;
            }
            startInfo.FileName = command;
            startInfo.Arguments = param;
          
            System.Diagnostics.Process.Start(startInfo);
        }

    }
}
